package com.boot.es.entity;

import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.List;


//indexName索引名称 可以理解为数据库名 必须为小写 不然会报org.elasticsearch.indices.InvalidIndexNameException异常
//type类型 可以理解为表名
@Document(indexName = "testdb", type = "typetable")
public class TestIndexEntity implements Serializable {
    @Id
    private Long id;
    // 编号，Keyword类型存储数据时候，不会分词建立索引
    @Field(type = FieldType.Keyword)
    private String no;
    // text类型 存储数据时候，会自动分词，并生成索引
    @Field(type = FieldType.Text)
    private String	name;
    @Field(type = FieldType.Integer)
    private Integer	age;



    public TestIndexEntity()
    {

    }
//    public TestIndexEntity(Long id, String no, String name, Integer age) {
//        this.id = id;
//        this.no = no;
//        this.name = name;
//        this.age = age;
//    }



    @Override
    public String toString() {
        return "TestIndexEntity{" +
                "id=" + id +
                ", no='" + no + '\'' +
                ", name='" + name + '\'' +
                ", age=" + age +
                '}';
    }



    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }


}

